How to get output to file from Remove |
您所在的位置:网站首页 › get date from file › How to get output to file from Remove |
Very new to Powershell. I have a script that goes through a folder and removes files not accessed within 14 days. I have been unable to get the output of removed files to write to a file.
Get-Childitem D:\Users -Recurse | where-object {$_.lastAccessTime -lt (get-date).adddays(-14)} | foreach{remove-item $_.fullname -recurse -force -verbose -whatif}
I've tried redirection, Output-File, etc. I may just be placing it in the wrong spot. Thanks |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |